package com.joysuch.wwyt.app.controller;

import com.joysuch.wwyt.app.service.AppInvestigateService;
import com.joysuch.wwyt.bp.bean.investigate.BpInvestigateAppTaskDto;
import com.joysuch.wwyt.bp.bean.investigate.BpInvestigatePlanBean;
import com.joysuch.wwyt.bp.bean.investigate.BpInvestigateRecordQueryBean;
import com.joysuch.wwyt.bp.entity.investigate.BpInvestigatePlan;
import com.joysuch.wwyt.bp.entity.investigate.BpInvestigateRecord;
import com.joysuch.wwyt.core.common.ajax.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 隐患排查
 *
 * @Author ZhangDong
 * @Date 2020/6/16 15:25
 */
@RestController
@RequestMapping("/bp/app/investigate")
@Api(tags = "/bp/app/investigate  App隐患排查")
@CrossOrigin
public class AppInvestigateController {

    @Autowired
    private AppInvestigateService appInvestigateService;

    /**
     * 排查计划查询: 指派给当前用户
     * 查询一次，这边要做缓存验证
     */
    @GetMapping("plan-list")
    @ApiOperation(value = "排查计划查询", response = BpInvestigateAppTaskDto.class)
    public ResultBean planList() {
        return appInvestigateService.planList();
    }

    @GetMapping("plan-get")
    @ApiOperation(value = "排查计划单体查询", response = BpInvestigatePlanBean.class)
    public ResultBean planGet(Long id) {
        return appInvestigateService.planGet(id);
    }

    @GetMapping("plan-getInfo")
    @ApiOperation(value = "排查计划单体查询", response = BpInvestigatePlanBean.class)
    public ResultBean getInfo(Long id) {
        return appInvestigateService.getInfo(id);
    }

    /**
     * 排查记录查询: 指派给当前用户
     */
    @GetMapping("record-list")
    @ApiOperation(value = "排查记录查询", response = BpInvestigateRecord.class)
    public ResultBean recordList(BpInvestigateRecordQueryBean bean) {
        return appInvestigateService.recordList(bean);
    }

    @GetMapping("/record-detail/{id}")
    @ApiOperation(value = "排查记录根据主键查询", response = BpInvestigateRecord.class)
    @ApiImplicitParam(name = "id", value = "排查记录id", paramType = "path", required = true)
    public ResultBean getById(@PathVariable Long id) {
        return appInvestigateService.getById(id);
    }

}
